#pragma once

#include <boost/operators.hpp>
#include <boost/date_time.hpp>
#include <boostext/typedefs.hpp>

#include "exports.hpp"




namespace Engine
{
	using namespace boost::posix_time;




	/**
	 * This class exposes two different methods of time measurement.
	 * First, it provides access to what is called real time: It describes the
	 * time, as observed by the player.
	 * The second on is game time, it describes the time, as observed by agents within
	 * the game (thus, mostly the AI).
	 */
	class ENGINE_CORE_API GameTime
	{
	public:

		/**
		 * Creates a new GameTime.
		 * Initializes both gameStatrt & lastFrame to the current time.
		 */
		GameTime();



		/**
		 * @returns the duration since the start of the game and now
		 */
		time_duration totalRealTime() const;

		/**
		 * @returns the duration since the last and this frame.
		 */
		time_duration elapsedRealTime() const;



		/**
		 * @returns the elapsed real time time as the fractional part of a second
		 */
		double relativeElapsedRealTime() const;

		/**
		 * Updates this game time.
		 */
		void update();

	private:

		ptime           m_gameStart;
		ptime           m_lastFrame;
		ptime           m_thisFrame;
		time_duration   m_frameTime;

		double          m_dt;
	};
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
